package com.example.servicefeign.controller;

import com.example.servicefeign.iservice.SchedualServiceHi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HiController {

    @Autowired
    SchedualServiceHi schedualServiceHi;

    @RequestMapping(value = "/hi")
    @ResponseBody
    public String sayHiForRequestParam(@RequestParam String name){
        return schedualServiceHi.sayHiFromClientOne(name);
    }

    @RequestMapping(value = "/hi/{name}")
    @ResponseBody
    public String sayHiForPathVariable(@PathVariable String name){
        return schedualServiceHi.sayHiFromClientTwo(name);
    }

    @RequestMapping(value = "/me")
    @ResponseBody
    public String me(){
        return "i am feign";
    }
}
